let { Service } = require('egg')
// const { mysql } = require('../../config/plugin')

class BackService extends Service {
  async getInfo(name) {
    let { mysql } = this.app
    let sql = `select * from testuser where name like ?`
    let res = await mysql.query(sql, ['%' + name + '%'])
    if (res) {
      if (res.length > 0) {
        return res[0]
      } else {
        return "查无此人"
      }

    } else {
      return "出错了"
    }

  }
}

module.exports = BackService